<template>
  <div class="i_bg bg_color">
    <!--Begin 用户中心 Begin -->
    <div class="m_content">
      <div class="m_left">
        <div class="left_n">管理中心</div>
        <div class="left_m">
          <div class="left_m_t t_bg1">资讯中心</div>
          <ul>
            <li><router-link to="/managerIndex/managerNews">资讯列表</router-link>  </li>
            <li v-if="user!=null&&user.type == 1"><router-link to="/managerIndex/managerNews/add">添加资讯</router-link></li>
          </ul>
        </div>
        <div class="left_m"  v-if="user!=null&&user.type == 1" >
          <div class="left_m_t t_bg3">商品中心</div>
          <ul>
            <li>
              <router-link to="/managerIndex/manageProduct"
                >商品管理</router-link
              >
            </li>
            <li>
              <router-link to="/managerIndex/manageProduct/add"
            >添加商品</router-link
              >
            </li>
            <li>
              <router-link to="/managerIndex/manageCollect" v-if="token!=null">用户收藏</router-link>
            </li>
          </ul>
        </div>
        <div class="left_m" v-if="token!=null">
          <div class="left_m_t t_bg1">订单中心</div>
          <ul>
            <li>
              <router-link to="/managerIndex/manageOrder/allOrder"
               v-if="user!=null&&user.type==1" >全部订单</router-link
              >
            </li>
            <li>
              <router-link to="/managerIndex/manageOrder/myOrder"
                >我的订单</router-link
              >
            </li>
          </ul>
        </div>
        <div class="left_m" v-if="token!=null">
          <div class="left_m_t t_bg2">用户中心</div>
          <ul>
            <li>   <router-link v-if="user.type == 1" to="/managerIndex/managerMyself"
              >我的信息</router-link></li>
            <li>
              <router-link to="/managerIndex/manageAddress"
                >收货地址</router-link
              >
            </li>
            <li>
              <router-link to="/managerIndex/manageUser" v-if="user!=null&&user.type==1">用户管理</router-link>
            </li>
          </ul>
        </div>
            <div class="left_m" v-if="user!=null&&user.type==1">
            	<div class="left_m_t t_bg4">分类中心</div>
                <ul>
                	<li><router-link to="/managerIndex/managerCategory" >分类列表</router-link>  </li>
                    <li><router-link to="/managerIndex/managerCategory/add">添加分类</router-link></li>
                </ul>
            </div>
      </div>
      
      <div class="m_right">
        <router-view></router-view>
      </div>
    </div>
    <!--End 用户中心 End-->

    <!--End Footer End -->
  </div>
</template>

<script>
export default {
    data(){
      return {
        token:null,
        user:null,
      }
    }, methods: {
        getTokenAndUser(){
          this.token=sessionStorage.getItem("token") || null;
          if (this.token) {
          const userData = sessionStorage.getItem("user");
          this.user= userData ? JSON.parse(userData) : null;
        }
        }
    },created(){
      this.getTokenAndUser();
    }
};
</script>

<style></style>
